package pgpchat;

import java.net.Socket;

import pgpframework.Message.PGPMessage;

public class MsgListener implements Runnable {

	Socket client;
	MessageActor messageActor;

	public MsgListener(Socket client, MessageActor messageActor) {
		this.client = client;
		this.messageActor = messageActor;
	}

	@Override
	public void run() {

		while (true) {
			PGPMessage msg = PGPHelper.receivePGPMsg(client);
			if (msg != null) {
				messageActor.receiveMsg(msg);
			}
		}
	}
}
